﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace DentistApplication
{
    /// <summary>
    /// Interaction logic for PF_LasVisitsWindow.xaml
    /// </summary>
    public partial class PF_LasVisitsWindow : Window
    {
        String[] months = { "styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień", "październik", "listopad", "grudzień" };
       
        public PF_LasVisitsWindow(int patientId, string header, bool ifLastVisit)
        {
            InitializeComponent();
            Patient p = DatabaseHandler.getPatient(patientId);

            laHeader.Content = header;
            la_nameLastname.Content = "Pacjent: " + p.firstname + " " + p.lastname;
            la_patientId.Content = "Kartoteka nr: " + p.id;
            if (ifLastVisit)
            {

                List<Visit> lv = DatabaseHandler.getPatientsVisits(patientId);
                lv.ForEach(v => list_visits.Items.Add(v.id+") data: "+v.date.Day + " "+months[v.date.Month]));
            }
            else
            {
                List<Timetable> lt = DatabaseHandler.getPAtientAppointments(patientId);
                lt.ForEach(v => list_visits.Items.Add(v.id + ") data: " + v.startDate.Date.Day + " " + months[v.startDate.Date.Month]));
            }


        }

        private void bt_close_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
